
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> 登录 | 企业内部DNS管理平台</title>
    <link rel="shortcut icon" href="/static/img/facio.ico" type="image/x-icon">
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/css/style.css" rel="stylesheet">
    <link href="/static/pulgin/sweetalert-master/dist/sweetalert.css" rel="stylesheet">
<style type = "text/css">
    .Validform_right{color:green}   
    .Validform_wrong{color:red}      
</style>

</head>


<body class="gray-bg">
    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>
                <h1 class="logo-name"><img src="/static/img/logo.png"></h1>
            </div>
            
            <h2>企业内部DNS管理平台</h2>
            <form id="loginForm" class='login' >
                <div class="form-group">
                    <input id="name" type="text" name="username" class="form-control" placeholder="Username" datatype="s5-16" errormsg="昵称至少5个字符,最多16个字符！" >
                </div>
                <div class="form-group">
                    <input id="password" type="password" name="password" class="form-control" placeholder="Password" required="">
                </div>
                <button id="loginbtn" type="submit" class="btn btn-primary block full-width m-b">登录</button>
            </form>
            <p class="m-t"> <small><b>Copyright</b>  © 2019</small> </p>
        </div> 
    </div>

    <!-- Mainly scripts -->
    <script src="/static/js/jquery-2.1.1.js"></script>
    <script src="/static/pulgin/sweetalert-master/dist/sweetalert.min.js"></script>        
    <script src="/static/js/bootstrap.min.js"></script>
    <script src="/static/js/Validform_v5.3.2_min.js"></script>

<script>

$('#loginbtn').on('click',function(){
    var check = $("#loginForm").Validform().check()
    if (check) {
          var str = $('#loginForm').serialize()
          console.log(str) 
          $.post("/login/",str,function(data){
          console.log(data)    
          data = JSON.parse(data)
          console.log(data)  
          if (data['code']==0){
            swal({ 
                title: "登录成功", 
                text: data['result'],   
                type: "success",   
                confirmButtonText: "确定"                                                                                      },function(){               
                  location.href="/center/"
                  }); 
         }else{ 
            swal("MY GOD",data['msg'],"error");
             }
     })
     return false
    }
})


$(function(){
   $(".login").Validform({                 
           tiptype:3             
               });
               })
</script>
</body>

</html>
